#
# "@(#) $Id: Summary.py,v 1.1.1.1 2006-07-27 03:16:08 gioshe Exp $"
#
# This work is released under the GNU GPL, version 2 or later.
#
from kdeemul import *

class Summary(KSqueezedTextLabel):
	def __init__(self,container = None):
		KSqueezedTextLabel.__init__(self,container)
		self.widget = None

	def attachTo(self,widget):
		if self.widget:
			QObject.disconnect(widget,PYSIGNAL("changed"),self.status)
		self.widget = widget
		QObject.connect(widget,PYSIGNAL("changed"),self.status)
		self.status(widget)
		
	def detachFrom(self,widget):
		try: QObject.disconnect(widget,PYSIGNAL("changed"),self.status)
		except: pass

	def status(self,widget):
		summary = widget.getSummary()
		self.setText(summary)
